include_directories(${CMAKE_CURRENT_SOURCE_DIR}/)

file(GLOB KERNEL_SRC
    ${CMAKE_CURRENT_SOURCE_DIR}/base/*.cc
    ${CMAKE_CURRENT_SOURCE_DIR}/fp32/*.cc
    ${CMAKE_CURRENT_SOURCE_DIR}/int8/*.cc
    ${CMAKE_CURRENT_SOURCE_DIR}/string/*.cc
    )
list(REMOVE_ITEM KERNEL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/int8/opt_op_handler.cc)

if (SUPPORT_TRAIN)
file (GLOB TRAIN_KERNEL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/fp32_grad/*.cc)
set(KERNEL_SRC ${KERNEL_SRC} ${TRAIN_KERNEL_SRC})
endif()

add_library(cpu_kernel_mid OBJECT ${KERNEL_SRC})

if (PLATFORM_ARM64)
  file(GLOB FP16_KERNEL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/fp16/*.cc)
  add_library(cpu_fp16_kernel_mid OBJECT ${FP16_KERNEL_SRC})
  file(GLOB OPT_KERNEL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/int8/opt_op_handler.cc)
  add_library(cpu_opt_kernel_mid OBJECT ${OPT_KERNEL_SRC})
endif ()

